package com.wutao.panzh.admin.content.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.panzh.UtilEntity.ResultVO;
import com.panzh.entity.HotelItemImag;
import com.panzh.myconst.CommonConst;
import com.wutao.panzh.service.HotelItemImagService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class HotelItemImagController {

    @Reference
    private HotelItemImagService hotelItemImagService;

    @RequestMapping("/get/all/hotel/imag")
    @ResponseBody
    public ResultVO getAllHotelImag(@RequestParam("hotelId") Integer hotelId){
        List<HotelItemImag> hotelItemImags = hotelItemImagService.getAllHotelImagByHotelId(hotelId);
        return new ResultVO<List<HotelItemImag>>(ResultVO.SUCCESS,ResultVO.NO_MSG,hotelItemImags);
    }

    @RequestMapping("/remove/hotel/imag")
    @ResponseBody
    public ResultVO removeHotelImag(@RequestParam("imagSrc") String imagSrc,
                                    @RequestParam("hotelId") Integer hotelId){
        hotelItemImagService.removeHotelImagByImageSrcAndHoteId(imagSrc,hotelId);
        return new ResultVO<String>(ResultVO.SUCCESS, CommonConst.DELETE_INFORMATION_SUCCESS,ResultVO.NO_DATA);
    }

}
